Component({
  /**
   * 组件的属性列表
   */
  properties: {
    teamCard: {
      type: Object,
      value: {},
    },
    memberData: {
      type: Array,
      value: [],
    },
    // memberLeader: {
    //   type: Object,
    //   value: {}
    // }
  },
  observers: {
    'memberData' () {
      let arr = [];
      for (let i = 0; i < this.properties.teamCard.memberTotal - this.properties.memberData.length; i++) {
        arr.push('')
      }
      this.setData({
        addTeamArr: arr,
      })
    }
  },
  options: {
    styleIsolation: 'apply-shared'
  },
  /**
   * 组件的初始数据
   */
  data: {
    btnStyle: '',
    addTeamArr: [],
  },
  lifetimes: {
    attached () {
      let btnStyle = wx.getStorageSync('activityBtnStyle')
      this.data.btnStyle = btnStyle

      this.setData({
        btnStyle,
      })
    }
  },
  pageLifetimes: {
  },
  /**
   * 组件的方法列表
   */
  methods: {
    /**
     * @see 点击右上角胶囊按钮
     */
    capsuleClick () {
      const { teamCard, memberData } = this.data
      this.triggerEvent('capsuleClick', { teamCard, memberData })
    },
    /**
     * @see 点击中间按钮
     */
    createTeam (e) {
      const { teamCard, memberData } = this.data
      this.triggerEvent('createTeam', { teamCard, memberData })
    },
    /**
     * @see 点击添加队友
     */
    addPlayer () {
      this.triggerEvent('addPlayer')
    }
  }
})
